package com.songlanyun.modules.aridroprecord.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.songlanyun.modules.user.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.songlanyun.modules.aridroprecord.entity.AridropRecordEntity;
import com.songlanyun.modules.aridroprecord.service.AridropRecordService;
import com.songlanyun.common.utils.PageUtils;
import com.songlanyun.common.utils.R;



/**
 * 积分空投记录
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2022-10-11 10:06:08
 */
@RestController
@RequestMapping("admin/aridroprecord")
public class AridropRecordController extends AbstractController {
    @Autowired
    private AridropRecordService aridropRecordService;

    /**
     * 列表
     */
    @RequestMapping("/page")
    //@RequiresPermissions("aridroprecord:aridroprecord:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = aridropRecordService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("aridroprecord:aridroprecord:info")
    public R info(@PathVariable("id") Long id){
		AridropRecordEntity aridropRecord = aridropRecordService.getById(id);

        return R.ok().put("aridropRecord", aridropRecord);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("aridroprecord:aridroprecord:save")
    public R save(@RequestBody AridropRecordEntity aridropRecord){
		aridropRecordService.save(aridropRecord);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("aridroprecord:aridroprecord:update")
    public R update(@RequestBody AridropRecordEntity aridropRecord){
		aridropRecordService.updateById(aridropRecord);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("aridroprecord:aridroprecord:delete")
    public R delete(@RequestBody Long[] ids){
		aridropRecordService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
